@inject ICurrentContext CurrentContext

@if (CurrentContext.InAppContext)
{
    <div id="app-submenu" class="nav-link-submenu">
        <div class="nav-link-submenu-title">App: @CurrentContext.AppId</div>
        @if (!CurrentContext.IsPendingDelete)
        {
            <NavMenuItem Href="@OnboardingUrl" Icon="typeof(StartIcon)" Label="Getting Started" />
            <NavMenuItem Href="@PlaygroundUrl" Icon="typeof(BeakerIcon)" Label="Playground" />
            <NavMenuItem Href="@UsersUrl" Icon="typeof(UsersIcon)" Label="Users" />
            <NavMenuItem Href="@ReportingUrl" Icon="typeof(StackedBarChartIcon)" Label="Reporting" />

            @if (CurrentContext.Features.EventLoggingIsEnabled)
            {
                <NavMenuItem Href="@AppLogsUrl" Icon="typeof(CodeBracketSquareIcon)" Label="App Logs" />
            }
        }
        <NavMenuItem Href="@SettingsUrl" Icon="typeof(CogIcon)" Label="Settings" />
    </div>
}

@code {
    private string OnboardingUrl => CurrentContext.InAppContext ? $"/app/{CurrentContext.AppId}/onboarding/get-started" : NavMenu.OrganizationOverviewUrl;
    private string PlaygroundUrl => CurrentContext.InAppContext ? $"/app/{CurrentContext.AppId}/playground/" : NavMenu.OrganizationOverviewUrl;
    private string UsersUrl => CurrentContext.InAppContext ? $"/app/{CurrentContext.AppId}/credentials/list" : NavMenu.OrganizationOverviewUrl;
    private string ReportingUrl => CurrentContext.InAppContext ? $"/app/{CurrentContext.AppId}/reporting" : NavMenu.OrganizationOverviewUrl;
    private string SettingsUrl => CurrentContext.InAppContext ? $"/app/{CurrentContext.AppId}/settings" : NavMenu.OrganizationOverviewUrl;
    private string AppLogsUrl => CurrentContext.InAppContext ? $"/app/{CurrentContext.AppId}/logs" : NavMenu.OrganizationOverviewUrl;
}